package com.px.service.service.impl;

import java.util.List;

import com.px.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.px.service.mapper.AncestralHallMemberMapper;
import com.px.service.domain.AncestralHallMember;
import com.px.service.service.IAncestralHallMemberService;

/**
 * 祠堂成员Service业务层处理
 *
 * @author 品讯科技
 * @date 2024-08
 */
@Service
public class AncestralHallMemberServiceImpl implements IAncestralHallMemberService {
    @Autowired
    private AncestralHallMemberMapper ancestralHallMemberMapper;

    /**
     * 查询祠堂成员
     *
     * @param id 祠堂成员主键
     * @return 祠堂成员
     */
    @Override
    public AncestralHallMember selectAncestralHallMemberById(Long id) {
        return ancestralHallMemberMapper.selectAncestralHallMemberById(id);
    }

    /**
     * 查询祠堂成员列表
     *
     * @param ancestralHallMember 祠堂成员
     * @return 祠堂成员
     */
    @Override
    public List<AncestralHallMember> selectAncestralHallMemberList(AncestralHallMember ancestralHallMember) {
        return ancestralHallMemberMapper.selectAncestralHallMemberList(ancestralHallMember);
    }

    /**
     * 新增祠堂成员
     *
     * @param ancestralHallMember 祠堂成员
     * @return 结果
     */
    @Override
    public int insertAncestralHallMember(AncestralHallMember ancestralHallMember) {
        ancestralHallMember.setCreateTime(DateUtils.getNowDate());
        return ancestralHallMemberMapper.insertAncestralHallMember(ancestralHallMember);
    }

    /**
     * 修改祠堂成员
     *
     * @param ancestralHallMember 祠堂成员
     * @return 结果
     */
    @Override
    public int updateAncestralHallMember(AncestralHallMember ancestralHallMember) {
        ancestralHallMember.setUpdateTime(DateUtils.getNowDate());
        return ancestralHallMemberMapper.updateAncestralHallMember(ancestralHallMember);
    }

    /**
     * 批量删除祠堂成员
     *
     * @param ids 需要删除的祠堂成员主键
     * @return 结果
     */
    @Override
    public int deleteAncestralHallMemberByIds(Long[] ids) {
        return ancestralHallMemberMapper.deleteAncestralHallMemberByIds(ids);
    }

    /**
     * 删除祠堂成员信息
     *
     * @param id 祠堂成员主键
     * @return 结果
     */
    @Override
    public int deleteAncestralHallMemberById(Long id) {
        return ancestralHallMemberMapper.deleteAncestralHallMemberById(id);
    }

    @Override
    public AncestralHallMember selectAncestralHallManager(Long ancestralHallId) {
        return ancestralHallMemberMapper.selectAncestralHallManager(ancestralHallId);
    }

    @Override
    public List<AncestralHallMember> selectBindAncestralMemberList(Long ancestralHallId) {
        return ancestralHallMemberMapper.selectBindAncestralMemberList(ancestralHallId);
    }
}
